<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
	<meta http-equiv="pragma" content="no-cache"  />
    <meta http-equiv="content-type" content="no-cache, must-revalidate" />
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT"/>
	
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
	<title>Full Layout - jQuery EasyUI Demo</title>
	<link rel="stylesheet" type="text/css" href="/resource/css/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="/resource/css/themes/icon.css">
	<!--<link rel="stylesheet" type="text/css" href="../demo.css">-->
	
</head>
<body class="easyui-layout">
	<div data-options="region:'north',border:false" style="height:60px;background:#B3DFDA;padding:10px">north region</div>
	<div data-options="region:'west',split:true,title:'主要菜单'" style="width:150px;padding:10px;">
			<div id="menuAccordion" data-module="main"></div>
	</div>
	
	<div data-options="region:'south',border:false" style="height:50px;background:#A9FACD;padding:10px;">south region</div>
	<div data-options="region:'center',title:'Center'">
		<div id='centerTabs' />
	</div>
</body>
<script type="text/javascript" src="/resource/js/jquery.min.js"></script>
<script type="text/javascript" src="/resource/js/jquery.easyui.min.js"></script>
<script src="/resource/js/jquery.validate.js" type="text/javascript"></script>
	<script src="/resource/js/messages_zh.min.js" type="text/javascript"></script>
	<script src="/resource/js/init.js" type="text/javascript"></script>
	<script src="/resource/js/bootstrap.min.js" type="text/javascript"></script>
	<script src="/resource/js/t3/t3.js" type="text/javascript"></script>
	<script src="/resource/js/t3/t3init.js" type="text/javascript"></script>
	<script src="/resource/js/t3/service/form-serv.js" type="text/javascript"></script>
	<script src="/resource/js/t3/service/ajax-serv.js" type="text/javascript"></script>
	<script src="/resource/js/t3/service/msg-serv.js" type="text/javascript"></script>
	<script src="/resource/js/t3/service/tab-serv.js" type="text/javascript"></script>
	<script src="/resource/js/t3/service/common/getElement-serv.js" type="text/javascript"></script>
	<script src="/resource/js/t3/module/main.js" type="text/javascript"></script>
<script>
$(document).ready(

	function (){
			
			app.init({
				debug: true,
				moduleConfig:{}
			})
			
			var $ma=$("#menuAccordion");
			$ma.accordion({animate:true,fit:true,border:false});
			$.post("/biz/getPermissions", null, function(rsp) {
				$.each(rsp,function(i,e){
					var menulist ="<div class=\"well well-small\">";
					if(e.child && e.child.length>0){
						$.each(e.child,function(ci,ce){
							var effort=ce.name+"||"+ce.iconCls+"||"+ce.url;
							menulist+="<a href=\"javascript:void(0);\" class=\"easyui-linkbutton\" data-options=\"plain:true,iconCls:'"+ce.iconCls + "'\"  bizcode='" + ce.bizcode + "'\"  targeturl='" + ce.pageUrl +"' data-type='accordion-btn'\>" +ce.name+"</a><br/>";
						});
					}
					menulist+="</div>";
					$ma.accordion('add', {
			            title: e.name,
			            content: menulist,
						border:false,
			            iconCls: e.iconCls,
			            selected: false
			        });
				});
			}, "JSON").error(function() {
				$.messager.alert("提示", "获取菜单出错,请重新登陆!");
			});		
			
			centerTabs = $('#centerTabs').tabs({
						tools : [ {
								iconCls : 'icon-reload',
								handler : function() {
									var href = $('#centerTabs').tabs('getSelected').panel('options').href;
									if (href) {/*说明tab是以href方式引入的目标页面*/
										var index = $('#centerTabs').tabs('getTabIndex', $('#centerTabs').tabs('getSelected'));
										$('#centerTabs').tabs('getTab', index).panel('refresh');
									} else {   /*说明tab是以content方式引入的目标页面*/
										var panel = $('#centerTabs').tabs('getSelected').panel('panel');
										var frame = panel.find('iframe');
										try {
											if (frame.length > 0) {
												for ( var i = 0; i < frame.length; i++) {
													frame[i].contentWindow.document.write('');
													frame[i].contentWindow.close();
													frame[i].src = frame[i].src;
												}
												if ($.browser.msie) {
													CollectGarbage();
												}
											}
										} catch (e) {
										}
									}
								}
							}, {
								iconCls : 'icon-cancel',
								handler : function() {
									var index = $('#centerTabs').tabs('getTabIndex', $('#centerTabs').tabs('getSelected'));
									var tab = $('#centerTabs').tabs('getTab', index);
									if (tab.panel('options').closable) {
										$('#centerTabs').tabs('close', index);
									} else {
										$.messager.alert('提示', '[' + tab.panel('options').title + ']不可以被关闭', 'error');
									}
                     			}
                    		},{
                    		   iconCls:'icon-color',
			                   handler:function(){
				                   $('#theme').menu({   
										onClick:function(item){   
				                        var cookiesColor1=jqueryUtil.cookies.get("cookiesColor");
				                        	if(cookiesColor1!=item.id){
												jqueryUtil.cookies.set("cookiesColor",item.id,30);
												jqueryUtil.chgSkin(item.id,cookiesColor1);
				                            }
										}   
										});
				                    $('#theme').menu('show', {   
											 left: '91%',   
											 top: 97   
									});
				                    }
                    		}],
					fit : true,
					border : false,
					onContextMenu : function(e, title) {
						e.preventDefault();
						tabsMenu.menu('show', {
							left : e.pageX,
							top : e.pageY
						}).data('tabTitle', title);
					}
				});
				
			
	
			var moduleel = document.getElementById('menuAccordion');
			app.start(moduleel);
		}
		
		
	)
	

</script>
</html>